package com.hn.springcloud.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * hanni
 * 2019/2/14 0014
 * 9:07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseVo {

    private String code ;//状态码 ：eg:404路径错误

    private String message;  //操作的结果 eg:成功或失败

    public static ResponseVo ok(){

        return  new ResponseVo("200","操作成功");
    }

    public static ResponseVo ok(String message){

        return  new ResponseVo("200",message);
    }


    public static ResponseVo error(){

        return  new ResponseVo("500","操作失败");
    }

    public static ResponseVo error(String message){

        return  new ResponseVo("500",message);
    }

    @Override
    public String toString() {
        return "ResponseVo{" +
                "code='" + code + '\'' +
                ", message='" + message + '\'' +
                '}';
    }
}
